package com.pureman.androidapp.utils;

import android.content.Context;
import android.content.pm.PackageManager;

/**
 * Created by Administrator on 2016/7/19 0019.
 */
public class AppUtil {

    /**
     * 获取当前程序的版本号
     *
     * @param context
     * @return
     */
    public static String getAppVersion(Context context) {
        String version = "0";
        try {
            version = context.getPackageManager().getPackageInfo(
                    context.getPackageName(), 0).versionName;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return version;
    }
}
